<!DOCTYPE html>
<html lang="en">
<head>
	{{template "pc/public/mycss.html" .}}
</head>
<style type="text/css">
	#wrapper{
		background: #f5f5f5!important;
	}
	.header-center{
		background: #fff;
	}
	.user_left{
		background: #fff;
	}
	.fenlei{
		width: 20%;
	}
	
	@media (max-width: 992px){
		.fenlei{
		    width: 100%;
		}
	}
</style>
<body class="common-home res layout-home1">
<div id="wrapper" class="wrapper-full banners-effect-7">
	<!-- Header Container  -->
	{{template "pc/public/head.html" .}}
  	{{template "pc/public/mytop.html" .}}
	<div class="main-container container">
		<div class="row mb-50">
			<!--Left Part Start -->
			{{template "pc/public/myleft.html" .}}
			<!--Middle Part Start-->
			<div id="content" class="col-md-10 col-sm-8 right mt-15">
				<div class="mycollection mybrowse">
					<div class="header">
						<ul>
							<li><a href="/my/collect">关注的商品</a></li>
							<li><a href="/my/focus">收藏的店铺</a></li>
							<li><a class="on" href="/my/foot">浏览历史</a></li>
						</ul>
					</div>
					<div class="box">
						<div class="empty mb-10">
							<!-- <span class="fl">仅展示最近30天的记录~~</span> -->
							<button class="clear">全部清空</button>
						</div>
						{{if .info}}
						<div class="goodslist">
							<!-- <h6>2015-20-50</h6> -->
							<ul>
								{{range .info}}
								<li id="{{.id}}">
									<a href="/product/content?id={{.pid}}">
										<img src="{{.pathname}}">
										<div>
											<p class="overpl1">{{.title}}</p>
											<p>￥ {{if .vprice0}}{{.vprice}}{{else}}{{.price}}{{end}}</p>
										</div>
									</a>
									<div class="p-stats">
										<a href="javascript:void(0);" class="shopcarAdd" data-id="{{.pid}}" data-minbuy='{{.minbuy}}'>
											<i class="fa fa-shopping-cart"></i>
											<em>加入购物车</em>
										</a>
										<a href="javascript:void(0);" class="del">
											删除
										</a>
									</div>
								</li>
								{{end}}
							</ul>
						</div>
						{{else}}

						<!-- 默认图 -->
						{{end}}
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<!-- Footer Container -->
{{template "pc/public/foot.html" .}}
{{template "pc/public/myfoot.html" .}}
</body>
</html>
<script type="text/javascript">
	$('.del').click(function(){
	    var id=$(this).parent().parent().attr('id')
	    wxc.xcConfirm("您确定要删除吗?","confirm",{onOk:function(){
	      $.ajax({
	        url:window.location.href,
	        data:{id:id},
	        type:'post',
	        success:function(res) {
	          if(res==1){
	            showToast('删除成功');
	            $('#'+id).remove()
	          }else{
	            showToast('网络繁忙,请重试');
	          }
	        }
	      })  
	    }});
	  })
	$('.clear').click(function(){
	    var id=$(this).parent().parent().attr('id')
	    wxc.xcConfirm("您确定要全部清除吗?","confirm",{onOk:function(){
	      $.ajax({
	        url:window.location.href,
	        type:'post',
	        success:function(res) {
	          if(res==1){
	            showToast('清除成功');
	           	history.go(0)
	          }else{
	            showToast('网络繁忙,请重试');
	          }
	        }
	      })  
	    }});
	  })
	$('.shopcarAdd').click(function(){
		var pid=$(this).attr('data-id')
		var minbuy=$(this).attr('data-minbuy')
	      $.ajax({
	        url:'/isShopcar',
	        type:"get",
	        data:{pid:pid},
	        success:function(res){
	          if (minbuy>1 && !res.isshopcar) {
	            wxc.xcConfirm("该产品的最小购买数为"+minbuy,"confirm",{onOk:function(){
	              $.ajax({
	                url:'/shopcar',
	                type:'post',
	                data:{num:1,pid:pid,minbuy:minbuy},
	                success:function(res){
	                  if(res==0){
	                    showToast('网络繁忙,请重试');
	                  }else if(res==1){
	                    showToast('加入购物车成功');
	                  }else if(res==2||res==962){
	                    wxc.xcConfirm("您还没有登入,请先登入","confirm",{onOk:function(){
	                      window.location.href="/login"
	                    }})
	                  }else if(res==3){
	                    showToast('库存不足');
	                  }
	                }
	              })
	            }})
	          } else {
	            $.ajax({
	              url:'/shopcar',
	              type:'post',
	              data:{num:1,pid:pid,minbuy:minbuy},
	              success:function(res){
	                if(res==0){
	                  showToast('网络繁忙,请重试');
	                }else if(res==1){
	                  showToast('加入购物车成功');
	                }else if(res==2||res==962){
	                  wxc.xcConfirm("您还没有登入,请先登入","confirm",{onOk:function(){
	                    window.location.href="/login"
	                  }})
	                }else if(res==3){
	                  showToast('库存不足');
	                }
	              }
	            })
	          }
	        }
	      })
	 })
	var $typeheader = 'header-home1';

	$('.order ul li').click(function() {
		$(this).addClass('on');
		$(this).siblings('li').removeClass('on');
	});
</script>
<